package com.ruoyi.dataroom.module.chart.bean;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;


@Data
public class Linkage {

    @Schema(description = "联动执行的逻辑")
    private Action action;

    @Schema(description = "组件的唯一标识，用于知道和谁做联动")
    private List<Component> components;

    @Data
    public static class Action {

        @Schema(description = "联动类型")
        private String type;

        @Schema(description = "联动执行的逻辑")
        private String script;
    }

    @Data
    public static class Component {

        @Schema(description = "组件的唯一标识，用于知道和谁做联动")
        private String componentKey;

        @Schema(description = "使用数据模型已有的关联关系进行联动查询")
        private boolean linkByRelation;

        @Schema(description = "映射关系")
        private List<Mapping> maps;
    }

    @Data
    public static class Mapping {

        @Schema(description = "源字段")
        private String sourceField;

        @Schema(description = "目标字段")
        private String targetField;

        @Schema(description = "查询规则")
        private String queryRule;
    }


}